<?php
class TableHelper extends AppHelper {
    public function open($htmlOptions = array('border' => '0')) {
        $out = "<table ";
        foreach($htmlOptions as $k => $v) {
            $out.= $k."="."\"".$v."\" ";
        }
        $out .= ">";
        return $out;
    }

    public function head() {

        $out = "<thead><tr>";
        foreach(func_get_args() as $header) {
            $out.= "<th>".$header."</th>";
        }
        $out .= "</tr></thead>";
        return $out;
    }
    
    public function bodyOpen() {
        return "<tbody>";
    }
    
    public function bodyClose() {
        return "</tbody>";
    }

    public function row() {
        $out = "<tr>";
        foreach(func_get_args() as $field) {
            $out.= "<th>".$field."</th>";
        }
        $out .= "</tr>";
        return $out;
    }

    public function close() {
        return "</table>";
    }
}
?>